#ifndef CHMVIEW_H
#define CHMVIEW_H

#include <QtGui/QWidget>
#include <QCoreApplication>
#include <QGridLayout>
#include <QWebView>
#include <QDockWidget>
#include "abstractview.h"
#include "bookdatabuilder.h"
#include "chmbookdatabuilder.h"
#include "mainwindow.h"

namespace Ui {
    class ChmView;
}

class ChmView : public AbstractView {
    Q_OBJECT
public:
    ChmView(QWidget *parent = 0);
    ~ChmView();
    virtual void preview();
    virtual void load(const QString &url);
    virtual void show(int index);
    virtual void showNext();
    virtual void showPrevious();
protected:
    void changeEvent(QEvent *e);
private slots:
    void onShow(const QModelIndex &);
    void load(const QUrl &url);
    QString getCachedDir();
private:
    Ui::ChmView *m_ui;
    BookData* bookData;
    QWebView* webView;
    QGridLayout *mainLayout;
    QTreeModel* temp;
    QString chmFileName;
};

#endif // CHMVIEW_H
